<?php

namespace WsdServer\Lib\Validation;

use Exception;

/**
 * Created by PhpStorm.
 * User: bobo
 * Date: 17-12-25
 * Time: 下午7:06
 */
class ValidException extends Exception
{
    protected $err_detail;

    public function __construct($messages, $code)
    {
        $str_message = "";
        if (is_array($messages)) {
            foreach ($messages as $msg) {
                if (is_array($msg)) {
                    foreach ($msg as $item) {
                        $str_message = $str_message." ".$item;
                    }
                }
            }
        }

        $this->err_detail = $messages;

        parent::__construct($str_message, $code);
    }

    final public function getErrDetail()
    {
        return $this->err_detail;
    }
}
